package cn.pugle.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.pugle.quartz.cluster.annotation.QuartzScheduled;

/**
 * Created by tzp on 16-11-17.
 */
@Component
public class MyJob implements Job {

    @Autowired
    private MyService myService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("hehe" + context.getMergedJobDataMap().get("c") + myService.service());

    }

    @QuartzScheduled(interval = 5000)
    public void invoke() {
        System.out.println("haha " + myService.service());
    }
}
